# Maintainer: Levente Polyak <anthraxx[at]archlinux[dot]org>
# Contributor: Letu Ren <fantasquex at gmail dot com>

_pyname=pyxbe
pkgname=python-${_pyname}
pkgver=1.0.1
pkgrel=3
pkgdesc='Library to work with XBE files, the executable file format for the original Xbox game console'
url='https://github.com/mborgerson/pyxbe'
arch=('any')
license=('custom:MIT')
depends=('python')
makedepends=('python-build' 'python-installer' 'python-wheel' 'python-setuptools')
checkdepends=('python-pytest')
source=("${url}/archive/v${pkgver}/${pkgname}-${pkgver}.tar.gz")
sha512sums=('07e4d8b7bc921d971cc1f7b095a33752548d94631cf8f28e586423da8182885eeef04fbebf5ef577bb774c2b6d39fcabb6c18f1ae1154f2a453af3726a36c672')
b2sums=('83c4197a496422695fd300e8901378fcbee6fca4d1f5408f9e391968efb8d6d124a33a061224382a83f35f2780b1c92d37ed913b5d99e62b478d745f9c9b497b')

build() {
  cd ${_pyname}-${pkgver}
  python -m build --wheel --no-isolation
}

check() {
  cd ${_pyname}-${pkgver}/tests
  PYTHONPATH="${PWD}/../build/lib" pytest
}

package() {
  cd ${_pyname}-${pkgver}
  python -m installer --destdir="$pkgdir" dist/*.whl
  install -Dm 644 LICENSE.txt -t "${pkgdir}/usr/share/licenses/${pkgname}"
  install -Dm 644 README.md -t "${pkgdir}/usr/share/doc/${pkgname}"
}

# vim: ts=2 sw=2 et:
